package Model::Document;


sub new
{
    my $class = shift;
    my $self = {
        _id => shift,
        _title  => shift,
    };
	# The object reference is created by blessing a reference to the package's class. 
    bless $self, $class;
    return $self;
}

sub create
{
	
}

sub find {
    my ($self, @params) = @_;
    die "used as an object method" if ref $self;
    # your code        
    # TODO mapping code. 
    my $d = new Model::Document();    
    return $d;
} 

sub to_string {
	my ($self) = @_;
	return "[document: id => $self->{_id}, title => '$self->{_title}']";
}

# did i mention that perl sucks
# http://stackoverflow.com/questions/5012665/perl-module-did-not-return-a-true-value

1;
